package source.s02.throwExceptionNoLock.controller;

import source.s02.throwExceptionNoLock.extthread.ThreadA;
import source.s02.throwExceptionNoLock.extthread.ThreadB;
import source.s02.throwExceptionNoLock.service.Service;

public class Test {

	//A线程代码抛出异常，所持有的锁自动释放
	public static void main(String[] args) {
		try {
			Service service = new Service();

			ThreadA a = new ThreadA(service);
			a.setName("a");
			a.start();

			Thread.sleep(500);

			ThreadB b = new ThreadB(service);
			b.setName("b");
			b.start();
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
	}

}
